package task4;

import java.util.Scanner;

public class Task2 {

    static Scanner input=new Scanner(System.in);

    public static void main(String[] args) {
        String s=input.nextLine();
        System.out.println(goodCenter(s));
    }
    private  static int goodCenter(String s){
        StringBuilder pre=new StringBuilder("");
        StringBuilder last=new StringBuilder("");

        int[] max={0,0};

        int head=0;
        int tail=s.length()-1;
        while (head<=tail)
        {
            char headC=s.charAt(head);
            char tailC=s.charAt(tail);

            pre.append(headC);
            last.insert(0,tailC);

            if(pre.toString().equals(last.toString()))
            {

                if(pre.length()>max[0])
                {
                    if(max[0]>max[1])
                        max[1]=max[0];

                    max[0]=pre.length();

                }
                else if(pre.length()>max[1])
                    max[1]=pre.length();
            }

            head++;
            tail--;
        }
        return s.length()-max[1]*2;
    }
}
